#include <stdio.h>
#include <algorithm>
using namespace std;

#define rep(i,n) for (int i=0; i<n; i++)

#define TRACE(x...) x
#define PRINT(x...) TRACE(printf(x))

#define INF 0x3f3f3f3f

int n;
int graph[210][210];
int e;
int a, b;
int f;

int main() {
	while (1) {
		scanf("%d", &n);
		if (!n) break;

		rep(i,n) rep(j,n) graph[i][j]=INF;
	
		scanf("%d", &e);

		rep(i,e) {
			scanf("%d %d", &a, &b);
			graph[a][b]=1;
		}

		rep(k,n) rep(i,n) rep(j,n) graph[i][j]=min(graph[i][j], graph[i][k]+graph[k][j]);

		f=1;
	
		rep(i,n) {
			if (graph[i][i]%2!=0 && graph[i][i]!=INF) {
				f=0;
				break;
			}
		}

		if (f) printf("BICOLORABLE.\n");
		else printf("NOT BICOLORABLE.\n");
	}

	return 0;
}
